﻿package mortal.game.view.guild.cellrender
{
    import Message.DB.Tables.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import extend.language.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;

    public class GuildBustlingRewardsItem extends GSprite
    {
        private var _titleBg:GBitmap;
        private var _titleName:GBitmap;
        private var _targetNum:BitmapNumberText;
        private var _rewardInfo:GTextFiled;
        private var _titleBgName:String;
        private var _offsetX:int;
        private var _data:TGuildActivityConfig;

        public function GuildBustlingRewardsItem(param1:String, param2:int)
        {
            this._titleBgName = param1;
            this._offsetX = param2;
            return;
        }// end function

        private function getEnabled() : Boolean
        {
            var _loc_1:* = Cache.instance.guild.selfGuildInfo.baseInfo.activity;
            var _loc_2:* = GuildActivityConfig.instance.getItemById((this._data.id + 1));
            return _loc_1 >= this._data.guildActivity && (_loc_2 == null || _loc_1 < _loc_2.guildActivity);
        }// end function

        public function set data(param1:TGuildActivityConfig) : void
        {
            var _loc_2:ItemInfo = null;
            var _loc_3:String = null;
            if (this._data == null)
            {
                this._data = param1;
                this._targetNum.text = this._data.guildActivity.toString();
                _loc_2 = ItemConfig.instance.getConfig(int(this._data.guildItemReward));
                _loc_3 = HTMLUtil.addColor(_loc_2.name + "*1", ColorConfig.instance.getItemColorString(_loc_2.color));
                this._rewardInfo.htmlText = Language.getStringByParam(70483, _loc_3, this._data.guildCoinReward, this._data.guildGoldReward);
                var _loc_4:* = this.getEnabled() ? (null) : ([FilterConst.colorFilter2]);
                this._targetNum.filters = this.getEnabled() ? (null) : ([FilterConst.colorFilter2]);
                var _loc_4:* = _loc_4;
                this._titleName.filters = _loc_4;
                this._titleBg.filters = _loc_4;
            }
            return;
        }// end function

        public function set titleBgName(param1:String) : void
        {
            this._titleBgName = param1;
            return;
        }// end function

        public function set offsetX(param1:int) : void
        {
            this._offsetX = param1;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._titleBg = UIFactory.gBitmap(this._titleBgName, 0, 0, this);
            this._titleName = UIFactory.gBitmap(ImagesConst.GuildBustlingTxt3, 25, 2, this);
            this._targetNum = UIFactory.bitmapNumberText(65, 19, "GuildBustlingNum.png", 14, 22, 0, this, 15, BitmapNumberText.Mid);
            pushUIToDisposeVec(UIFactory.bitmap(ImagesConst.GuildBustlingBg2, 6 + this._offsetX, 41, this));
            this._rewardInfo = UIFactory.gTextField("" + Language.getString(71090), 7 + this._offsetX, 63, 170, 120, this);
            this._rewardInfo.multiline = true;
            this._rewardInfo.wordWrap = true;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._offsetX = 0;
            this._titleBg.dispose(param1);
            this._titleName.dispose(param1);
            this._targetNum.dispose(param1);
            this._rewardInfo.dispose(param1);
            this._data = null;
            return;
        }// end function

    }
}
